<template>
	<view class="newsList">
		<!-- 列表 -->
		<view class="list flex-r-a-c" v-for="(item,index) in newsList" :key="index" @tap="goNewsDetails(item.id)">
			<button class="btn_none flex-r-a-c" style="width: 100%; height: 100%; background-color: #FFF0;" >
				<image :src="item.image" mode=""></image>
				<view class="list_f flex-r-b-c">
					<view class="list_f_l">
						<view class="name">{{item.title}}</view>
						<view class="title">{{item.isnew}}</view>
					</view>
					<view class="list_f_f flex-r-s-c">
						<view class="time">{{item.nowtime}}</view>
						<u-icon name="arrow-right" color="#A0A0A0" size="24"></u-icon>
					</view>
				</view>
			</button>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newsList: [], // 获取消息列表
			};
		},
		onLoad() {
			this.getNewsList() // 获取消息列表
		},
		methods:{
			// 获取消息列表
			getNewsList(){
				let that = this
				that.$api.news_list().then(res => {
					that.newsList = res.data.data
				})
			},
			// 跳转消息详情
			goNewsDetails(id){
				if(id == 2){
					
					wx.openCustomerServiceChat({ // 客服
						extInfo: {
							url: 'https://work.weixin.qq.com/kfid/kfcfabe188f48472048'
						},
						corpId: 'ww482f5a23d248eb06',
						success(res) {
							console.log(res)
						},
						fail(err) {
							console.log(err)
						}
					})
					
				} else {
					
					uni.navigateTo({
						url: '/message/newsDetailsList/newsDetailsList?id=' + id
					})
					
				}
			}
		}
	}
</script>

<style lang="less">
	.newsList{
		width: 90vw;
		margin: 30rpx auto;
		padding-bottom: 40rpx;
		.list{
			width: 100%;
			height: auto;
			background-color: #FFFFFF;
			border-radius: 20rpx;
			box-sizing: border-box;
			padding: 30rpx;
			margin: 30rpx 0rpx;
			image{
				width: 106rpx;
				height: 106rpx;
			}
			.list_f{
				width: 80%;
				.list_f_l{
					line-height: 50rpx;
					.name{
						color: #4B4B4B;
						font-weight: 500;
						font-size: 32rpx;
					}
					.title{
						color: #A0A0A0;
						font-size: 24rpx;
						font-weight: 400;
					}
				}
				.list_f_f{
					font-size: 24rpx;
					font-weight: 500;
					color: #A0A0A0;
				}
			}
		}
		//
	}
</style>
